<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Routing\UrlGenerator;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        error_reporting(E_ERROR);
    }

    /**
     * Bootstrap any application services.
     *
     * @param UrlGenerator $url
     *
     * @return void
     */
    public function boot(UrlGenerator $url): void
    {
        \App\Models\BaseModel::observe(\App\Observers\ModelObserver::class);

        if ($_SERVER['REQUEST_SCHEME'] === 'https' || env('FORCE_HTTPS') == 1) {
            url()->forceScheme('https');
            $this->app['request']->server->set('HTTPS', true);
        }
    }
}
